<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>用户管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-table :data="rolesList" stripe style="width: 100%" border>
      <el-table-column type="index" width="180" label="#" align="center"></el-table-column>
      <el-table-column prop="authName" label="权限名称" align="center"></el-table-column>
      <el-table-column prop="path" label="路径" align="center"></el-table-column>
      <el-table-column prop="level" label="等级" align="center">
        <template slot-scope="scope">
          <!-- {{scope.row}} -->
          <div>
            <el-tag v-if="scope.row.level==0">一级标签</el-tag>
            <el-tag type="success" v-if="scope.row.level==1">二级标签</el-tag>
            <el-tag type="danger" v-if="scope.row.level==2">三级标签</el-tag>
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      rolesList: []
    }
  },
  methods: {
    async getRolseList() {
      let { data: res } = await this.axios.get('rights/list')
      // console.log(res);
      if (res.meta.status != 200) return this.$message.error('请求错误')
      this.rolesList = res.data
    }
  },
  created() {
    this.getRolseList()
  }
}
</script>

<style lang="less" scoped>
.el-table {
  margin-top:14px;
}
</style>

